import request from './request';

// 获取任务列表
export const getTaskList = (data) => {
    return request({
        url: '/task/list', 
        method: 'post',
        data: data
      });
};

// 创建任务
export const createTask = (data) => {
    return request({
        url: '/task/add', 
        method: 'post',
        data: data
      });
};

// 更新任务
export const updateTask = (data) => {
    return request({
        url: '/task/update', 
        method: 'post',
        data: data
      });
}; 
// 删除任务
export const deleteTask = (taskId) => {
    return request({
        url: '/task/delete', 
        method: 'get',
        params: {
            taskId: taskId
        }
      });
};

//绑定任务
export const bindTask = (taskId) => {
    return request({
        url: '/task/bind', 
        method: 'get',
        params: {
            taskId: taskId
        }
      });
};

// 解绑任务
export const unbindTask = (taskId) => {
    return request({
        url: '/task/unbind', 
        method: 'get',
        params: {
            taskId: taskId
        }
      });
};

// 修改任务状态
export const changeTask = (taskId, status) => {
    return request({
        url: '/task/change', 
        method: 'get',
        params: {
            taskId: taskId,
            taskStatus: status
        }
      });
};